import { defineStore } from 'pinia'
import { ref } from 'vue'
import { get } from '@/utils/api'

export const useAdminOrderStore = defineStore('adminOrder', () => {
  const tableData = ref<object[]>([])

  const tableLoading = ref<string>('')

  const getData = async () => {
    tableData.value = []
    tableLoading.value = 'loading'
    tableData.value = await get('/api/order/getAll')
    tableLoading.value = ''
  }

  const deleteVisible = ref<boolean>(false)
  const deleteIds = ref<number[]>([])
  const contentLoading = ref<boolean>(true)
  return {
    tableData,
    tableLoading,
    getData,
    deleteVisible,
    deleteIds,
    contentLoading
  }
})
